#去重复
# a = [1,2,1,3,5,5]
# def func(a):
#     x = []
#     for i in a:
#         if i not in x:
#             x.append(i)
#     print(x)
# A = func(a)

#在文件里去除空格展示
# with open('text.txt','r',encoding='utf8') as f:
#     a = f.readlines()
#     print(a)
#     lst2 = []
#     for i in a:
#         a = i.split(',')
#         # print(a)
#         lst1=[]
#         for j in a:
#             c = int(j.strip(','))
#             print(c)
#
#             lst1.append(c)
#             print(lst1)
#         lst2.append(tuple(lst1))
#     print(lst2)


#判断（是否正确
# a = '(1+2)+(3+4)'
# def func(a):
#     lef = '('
#     rig =')'
#     lst_1=[]
#     if a.count('(') == a.count(")"):
#         for i in range(len(a)):
#             if a[i] ==lef:
#                 lst_1.append(a[i])
#             elif a[i] == rig:
#                 lst_1.remove('(')
#         return True
#
#     else:
#         return False
#
#
# A=func(a)
# print(A)


#找唯一不重复的
# a= [1,2,2,1,3,3,4,5,4,5,8]
# lst1 = []
# def func(a):
#     lst1 = list(set(a))
#     for i in lst1:
#         c = 0
#         for j in a:
#             if i == j:
#                 c +=1
#         if c == 1:
#             return i
# A = func(a)
# print(A)

# #小球高处垂直掉落每次反弹1/3次计算最后一次高度和总弹起高度
# def func(a,b):
#     c = 0
#     for i in range(1,b+1):
#         # print(i)
#         hei = a*(1/3)**i
#         c = c+hei
#     print('第%d次高度:%.2f,总高度:%.2f,' % (i,hei,c))
# A=func(100,3)

#青蛙跳台阶 有多少中跳法
# def fib(m):
#     if m == 1:
#         return 1
#     if m == 2:
#         return 2
#     if m>2:
#         return fib(m-1)+fib(m-2)
# def func(n):
#     if n == 1:
#         return 1
#     if n == 2:
#         return 2
#     if n>2:
#         return fib(n-1)+fib(n-2)
# print(func(6))


#给定数字加减
#方法1
# a = [1,2,3,4,8,6,9]
# def func(a,num):
#     for i,j in enumerate(a):
#         # print(i,j)
#         k=i+1
#         if a[k:].count(num-j)>0:
#             for n in range(a[k:].count(num-j)):
#                 b = a.index(num-j,k)
#                 print(i,b)
#                 k= b+1
# A=func(a,5)
#方法二
# def func(a,num):
#     for i in a:
#         # print(i)
#         for j in a[a.index(i)+1:]:
#             # print(a[a.index(i)+1:],end='\\')
#             # print(j)
#             if j == num-i:
#                 print(a.index(i),end=' ')
#                 print(a.index(j))
#
# func([1,3,5,6,7,8],9)





#给4个数字组成不重复三位数
# a= [1,2,3,4]
# def func(a):
#     e = 0
#     for i in a:
#         for j in a:
#             for x in a:
#                 if i!=j and i!=x and j!=x:
#                     e = e+1
#     print(e)
# A=func(a)

#给定数组 去重返回ture false
# a = [1,2,3,4]
# def func(a):
#     s = set(a)
#     return len(a) ==len(s)
# A=func(a)
# print(A)






















